home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 19.zip / BS1 part 19 / AmigaLibDisk 154.adf / PrintSpool / Print_Spool.h < prev    next >
C/C++ Source or Header  |  1987-06-15  |  7KB  |  172 lines

  1.  
  2. /* Print_Spool.h    V1.0.0    27-Mar-1988    ) Frangois Gagnon */
  3.  
  4.  
  5. /*
  6.    Copyright ) 1988  Frangois Gagnon,  All Rights Reserved.
  7.  
  8.    The author does not make any warranty expressed or implied,
  9.    or assumes any liability or responsiblity for the use of
  10.    this software.
  11.  
  12.    Permission is hereby granted to copy, reproduce, redistribute
  13.    or otherwise use this software as long as it is for non-profit.
  14.    This notice and the above copyright notice must remain intact
  15.    and appear on all copies.
  16.  
  17.    Permission is also granted to correct any problems with this
  18.    software, but modifications and improvements are reserved by
  19.    the author.
  20. */
  21.  
  22. /*****************************************/
  23. /* Definition of the Command information */
  24. /*****************************************/
  25.  
  26. #define    PS_Insert    11    /* Insert a name in the list    */
  27. /* This command inserts a list of names into the print queue. If the    */
  28. /* spooler is in the Wait_State, it will go to Exec_State and will    */
  29. /* start to print the first file.                    */
  30.  
  31. #define PS_Update    12    /* Update names from the list    */
  32. /* This command updates the options and flags values of the files that    */
  33. /* match the specified pattern. The file being printed will be affected */
  34. /* by this command but the value will only be used if multiple copies    */
  35. /* of the file are to be printed. A copy of the modified entries are    */
  36. /* sent back to the requesting program.                 */
  37.  
  38. #define PS_Remove    13    /* Remove names from the list    */
  39. /* This command removes the files that match the specified pattern. The */
  40. /* file being printed will be affected by this command and the affected */
  41. /* entries are sent back to the requesting program.            */
  42.  
  43. #define PS_Report    14    /* Report the names of the list */
  44. /* This command requests that the status of the spooler with a copy of    */
  45. /* the print queue be sent to the requesting program.            */
  46.  
  47. #define PS_Return    15    /* Return when all completed    */
  48. /* This command toggles the flag indicating wheter the program must    */
  49. /* terminate its execution after the last file is printed. It will    */
  50. /* normally wait for a new file to print instead of terminating. It is    */
  51. /* still possible to modify the print queue even if the flag is set.    */
  52. /* Great care nust be taken not to loose messages.            */
  53.  
  54. #define PS_Change    16    /* Change the paper format    */
  55. /* This command indicates that the format of the paper has been changed */
  56. /* to the format required for the next file.                */
  57. ^L
  58. #define PS_Freeze    21    /* Freeze the printing activity */
  59. /* This command requests that the spooler stops printing the current    */
  60. /* file immediately and waits for further commands. The printing can be */
  61. /* restarted from the point it was stopped. This command will only be    */
  62. /* executed if the spooler is waiting for a file name or printing one.    */
  63. /* It will also overide a PS_Finish command by forgeting it was ever    */
  64. /* executed.                                */
  65.  
  66. #define PS_Finish    22    /* Finish the printing activity */
  67. /* This command requests that the spooler stops after printing the    */
  68. /* current file and waits for further commands. This command will    */
  69. /* override a PS_Freeze command by resuming the printing.        */
  70.  
  71. #define PS_Resets    23    /* Resets the printing activity */
  72. /* This command requests that the spooler stops printing the current    */
  73. /* file immediately and waits for further commands. The File_Copy    */
  74. /* counter is not decremented. This command will override the PS_Freeze */
  75. /* command.                                */
  76.  
  77. #define PS_Cancel    24    /* Cancel the printing activity */
  78. /* This command requests that the spooler stops printing the current    */
  79. /* file immediately and waits for further commands. The File_Copy    */
  80. /* counter is decremented as if the file was completed.    It will     */
  81. /* override the PS_Freeze command.                    */
  82.  
  83. #define PS_Resume    25    /* Resume the printing activity    */
  84. /* This command restarts the spooler activity after being stopped by    */
  85. /* one of the others control commands. The command will also cancel a    */
  86. /* PS_Finish which as not yet completed for the current file.        */
  87.  
  88. /*****************************************/
  89. /* Definition of the Options information */
  90. /*****************************************/
  91.  
  92. #define Line_Density    0x03    /* 10, 12 or 17 chars per inch    */
  93. #define Line_Formats    0x04    /* 8 or 13 inches page wide    */
  94. #define Page_Density    0x08    /* 6 or 8 lines per inch    */
  95. #define Page_Formats    0x10    /* 8.5 or 11 inches page long    */
  96. #define Opts_Headers    0x20    /* Add headers to pages  */
  97. #define Opts_Numbers    0x40    /* Add numbers to lines  */
  98.  
  99. #define Flag_Quality    0x01    /* Type of char printing */
  100. #define Flag_Deleted    0x02    /* Delete after pinting  */
  101.  
  102. #define Line_10     0x00    /* 10 chars per inch */
  103. #define Line_12     0x01    /* 12 chars per inch */
  104. #define Line_17     0x02    /* 17 chars per inch */
  105. #define Line_8        0x00    /* 8 inchs wide  */
  106. #define Line_13     0x04    /* 13 inchs wide */
  107.  
  108. #define Page_6        0x00    /* 6 lines per inch  */
  109. #define Page_8        0x08    /* 8 lines per inch  */
  110. #define Page_85     0x00    /* 8.5 inchs long */
  111. #define Page_11     0x10    /* 11 inchs long  */
  112.  
  113. #define Flag_Updated    0x80    /* If update was successful */
  114. #define Flag_Partial    0x80    /* If the result is partial */
  115. ^L
  116. /*************************************/
  117. /* Defintion of the File information */
  118. /*************************************/
  119.  
  120. #define Name_Size    96    /* Maximum number of character    */
  121. #define Date_Size    20    /* Exact number of character    */
  122.  
  123. typedef struct    Detail_File
  124.     { struct Detail_File   *File_Next;
  125.       char            File_Name[Name_Size];
  126.       short          File_Copy;
  127.       byte            File_Opts;
  128.       byte            File_Flag;
  129.       char            File_Date[Date_Size];
  130.       long            File_Size;
  131.     } File;
  132.  
  133. /*****************************************/
  134. /* Definition of the Spooler information */
  135. /*****************************************/
  136.  
  137. #define Wait_State    0    /* Waiting for a file to print     */
  138. #define Page_State    1    /* Waiting to change the paper     */
  139. #define Open_State    2    /* Waiting to access the printer   */
  140. #define Exec_State    3    /* Is currently printing a file       */
  141. #define File_State    4    /* Will be stopped after the file  */
  142. #define Susp_State    5    /* Suspended between two files       */
  143. #define Stop_State    6    /* Stopped in the middle of a file */
  144.  
  145. typedef struct    Status_Info
  146.     { byte    Vers_State; /* Current version of spooler   */
  147.       byte    Prog_State; /* Current state of the spooler */
  148.       byte    Opts_State; /* Current options for printing */
  149.       bool    Flag_State; /* If must terminate execution  */
  150.       long    Char_Print; /* Number of chars printed */
  151.       long    Line_Print; /* Number of lines printed */
  152.       long    Page_Print; /* Number of pages printed */
  153.       File *File_Print; /* List of files to print  */
  154.     } Info;
  155.  
  156. /*************************************/
  157. /* Definition of Control information */
  158. /*************************************/
  159.  
  160. #define    SPOOLNAME    "SPOOL"
  161. #define    PROTOCOL    1
  162.  
  163. union    Details { File *Insert, *Update;
  164.           char    Remove[Name_Size];
  165.           Info  Status;
  166.         };
  167.  
  168. struct    Inform    { struct Message Packet;
  169.           short      Number, Action;
  170.           union  Details Detail;
  171.         };
  172.